// components/changeTime/changeTime.js
Component({
  options: {
    multipleSlots: true // 在组件定义时的选项中启用多slot支持
  },
  /**
   * 组件的属性列表
   */
  properties: {
    propA: {
      type: String
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    timeList: [{
      name: '上午',
      value: '09:30~10:00'
    }, {
      name: '下午',
      value: '14:00~15:00'
    }, {
      name: '晚上',
      value: '19:00~19:30'
    }],
    id: null,
    time: ''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    tabChange: function (e) {
      console.log('选择', e)
      this.setData({
        id: e.currentTarget.dataset.id
      })
      let i = e.currentTarget.dataset.id
      this.setData({
          time: this.data.timeList[i].name + this.data.timeList[i].value
      })
      let myEventDetail = this.data.time
      this.triggerEvent('myevent', myEventDetail, this.data.time)
    }
  }
})
